package com.zhengqing.design.action.command._01;

import com.zhengqing.design.action.command._01.service.ICuisine;
import org.assertj.core.util.Lists;

import java.util.List;

/**
 * <p> 命令调用类 </p>
 *
 * @author zhengqingya
 * @description
 * @date 2022/12/22 10:44
 */
public class Broker {
    private List<ICuisine> cuisineList = Lists.newArrayList();

    public void takeOrder(ICuisine iCuisine) {
        this.cuisineList.add(iCuisine);
    }

    public void placeOrders() {
        for (ICuisine ICuisine : this.cuisineList) {
            ICuisine.cook();
        }
        this.cuisineList.clear();
    }
}